﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LevelToggle : BaseUi {
    public GameObject levelNode;
    Toggle toggleCom;
    public void init (Transform parent, GameObject levelNode, string recycleType, int level) {
        this.levelNode = levelNode;
        transform.SetParent (parent, false);
        toggleCom = GetComponent<Toggle> ();
        toggleCom.isOn = true;
        GetComponentInChildren<Text> ().text = level.ToString ();
    }
    //点击时
    public void onToggle () {
        if (levelNode != null) {
            levelNode.SetActive (toggleCom.isOn);
        }
    }
}